
package com.ezlcp.user.controller;

import com.ezlcp.commons.base.db.BaseService;
import com.ezlcp.commons.base.entity.JsonResult;
import com.ezlcp.user.entity.Dictionary;
import com.ezlcp.user.service.DictionaryServiceImpl;
import com.ezlcp.user.web.BaseController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/ezlcp/user/dictionary")
@Tag(name = "数据字典")
public class DictionaryController extends BaseController<Dictionary> {
    @Autowired
    DictionaryServiceImpl dictionaryService;

    @Override
    public BaseService getBaseService() {
        return dictionaryService;
    }

    @Operation(summary = "查询字典主表")
    @PostMapping("/getDictionary")
    public JsonResult getDictionary(@Parameter(description = "字典关键字列表") @RequestParam("dicKeyList") String dicKeyList) {
        return JsonResult.getSuccessResult(dictionaryService.getByDicKey(dicKeyList), "common.selSuccess");
    }

    @Override
    public String getComment() {
        return "数据字典";
    }
}